home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / console-setup < prev    next >
Text File  |  2008-06-11  |  2KB  |  75 lines

  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          console-setup
  4. # Required-Start:    $remote_fs
  5. # Required-Stop:
  6. # Should-Start:      console-screen
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: Set console font and keymap
  10. ### END INIT INFO
  11.  
  12. set -e
  13.  
  14. test -f /bin/setupcon || exit 0
  15.  
  16. if [ -f /lib/lsb/init-functions ]; then
  17.     . /lib/lsb/init-functions
  18. else
  19.     log_action_begin_msg () {
  20.     echo -n "$@... "
  21.     }
  22.  
  23.     log_action_end_msg () {
  24.     if [ "$1" -eq 0 ]; then 
  25.         echo done.
  26.     else
  27.         echo failed.
  28.     fi
  29.     }
  30. fi
  31.  
  32. # Are we running from init?
  33. run_by_init()
  34. {
  35.     ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
  36. }
  37.  
  38. case "$1" in
  39.     stop)
  40.         # console-setup isn't a daemon
  41.         ;;
  42.     start|force-reload|restart|reload)
  43.     if expr "$(fgconsole 2>/dev/null || true)" : '[1-6]$' >/dev/null && \
  44.        ! pidof usplash >/dev/null; then
  45.         log_action_begin_msg "Setting up console font and keymap"
  46.         # Only use --save if we aren't in the boot sequence, to avoid
  47.         # slowing down the boot too much. Outside the boot sequence,
  48.         # this means that 'dpkg-reconfigure console-setup' automatically
  49.         # saves the font and keymap.
  50.         if run_by_init; then
  51.         save=
  52.         else
  53.         save=--save
  54.         fi
  55.         if setupcon --force $save; then
  56.         log_action_end_msg 0
  57.         else
  58.         log_action_end_msg $?
  59.         fi
  60.     elif ! run_by_init; then
  61.         log_action_begin_msg "Saving console font and keymap for next boot"
  62.         if setupcon --save-only; then
  63.         log_action_end_msg 0
  64.         else
  65.         log_action_end_msg $?
  66.         fi
  67.     fi
  68.     ;;
  69.     *)
  70.         echo 'Usage: /etc/init.d/console-setup {start|reload|restart|force-reload|stop}'
  71.         exit 1
  72.         ;;
  73. esac
  74.  
  75.